<template>
	<view class="content">
		<ljs-treeChoose :data="department" @getChooseValue="getDepartmentValue" @close="closeTree"
			v-if="departmentTag" />
		<u-modal title="问题闭环" ref="uModal" async-close show-cancel-button v-model="show_modal"
			@cancel="handleModalCancel" @confirm="handleModalConfirm">
			<view class="slot-content" style="padding: 20px">
				<u-checkbox-group wrap @change="checkboxGroupChange">
					<u-checkbox v-model="item.checked" v-for="(item, index) in faultList" :key="index"
						:name="item.label">{{ item.label }}</u-checkbox>
				</u-checkbox-group>
			</view>
		</u-modal>

		<view class="app-title ac">
			<view class="fl" @click="back">
				<image class="back" src="/static/img/back.png"></image>
			</view>问题单详情
		</view>
		<view class="top-bg"></view>

		<view class="detail fault-info" v-show="tab == 0">
			<view class="ac tab" style="padding-top: 20px">
				<view class="type" :class="{ on: tab == 0 }" @click="tab = 0">问题单信息</view>
				<view class="type" :class="{ on: tab == 1 }" @click="tab = 1">流转信息</view>
			</view>

			<view class="job-detail">原因概述：</view>
			<textarea class="text" v-model="data_list.reason"></textarea>
			<view class="job-detail">问题处置情况：</view>
			<textarea class="text" v-model="data_list.dealContent"></textarea>
			<view class="job-detail">处理意见：</view>
			<textarea class="text" v-model="data_list.message"></textarea>
			<u-cell-group>
				<u-cell-item title="转派部门:" v-show="
            checkOperationDefine('WeiDiaoTransfer') ||
            checkOperationDefine('WeiDiaoXiaoHaoProcess')
          " :value="org_name == '' ? '请选择' : org_name" @click="show_dep = true"></u-cell-item>
				<u-cell-item title="转派部门:" v-if="checkOperationDefine('FaultTransfer') && assign != 3"
					:value="org_name == '' ? '请选择' : org_name" @click="
            show_picker = true;
            isAuto = 1;
            columns = trans_options;
          "></u-cell-item>
				<u-cell-item title="" value="" :arrow="false"
					style="align-items: flex-start; flex-direction: column"><b>问题单信息</b></u-cell-item>
				<u-cell-item title="接报时间:" :value="
            data_list.receiveTime == '' ? '请选择' : data_list.receiveTime
          " @click="
            show_date = false;
            date_type = 'receiveTime';
          ">
				</u-cell-item>
				<u-cell-item title="线路" :value="lineName == '' ? '请选择' : lineName" @click="
            show_picker = true;
            isAuto = '';
            columns = line_options;
          "></u-cell-item>
				<u-cell-item title="问题地点" :value="
            stationName == '' || stationName == 'null' ? '请选择' : stationName
          " @click="filterStation();show_station = true;"></u-cell-item>
				<u-cell-item title="设备类型:" :value="!data_list.equTypeName ? '请选择' : data_list.equTypeName"
					@click="getEquTypeByStationId() ">
				</u-cell-item>

				<u-cell-item title="设备:" :value="data_list.equName?data_list.equName:'请选择'"
					@click.self="show_device = true;  getEquList();deviceName=data_list.equName">
				</u-cell-item>
				<!-- isAuto = '';
            columns = station_options; -->
				<u-cell-item title="填  写 人:" :value="data_list.createName" :arrow="false"></u-cell-item>
				<u-cell-item title="发  现 人:" :value="data_list.discoverer" @click="show_people = true;
			columns = leaderOptions;
			label_name = 'name';
			selece_type='people'
			value_name = 'idK';">

				</u-cell-item>
				<u-field v-model="data_list.contactPhone" label="发现人电话:" placeholder=""></u-field>
				<u-cell-item title="问题开始时间:" :value="
            data_list.faultStartTime == '' ? '请选择' : data_list.faultStartTime
          " @click="
            show_date = true;
            date_type = 'faultStartTime';
          ">
				</u-cell-item>
				<u-cell-item title="问题等级" :value="faultLevelName == '' ? '请选择' : faultLevelName" @click="
            show_picker = true;
            isAuto = '';
            columns = faultLevel_options;
          "></u-cell-item>
				<u-cell-item title="责任单位" :value="dutyOrgName == '' ? '请选择' : dutyOrgName" @click="
            show_picker = true;
            isAuto = 1;
            columns = dutyOrg_options;
          "></u-cell-item>
				<u-cell-item title="整改时限:" :value="data_list.limitTime == '' ? '请选择' : data_list.limitTime" @click="
            show_date = true;
            date_type = 'limitTime';
          ">
				</u-cell-item>
				<u-cell-item title="问题现象" :value="data_list.faultItem == '' ? '请选择' : data_list.faultItem" @click="
				  checkReson('old') "></u-cell-item>
			</u-cell-group>
			<u-radio-group v-model="data_listFaultstatus" style="height: 50px; width: 100%" placement="row">
				<text style="display: inline-block; line-height: 50px; margin-right: 20%">问题位置:</text>
				<u-radio :name="1" :disabled="false">车站</u-radio>
				<u-radio :name="2" :disabled="false">区间</u-radio>
				<u-radio :name="3" :disabled="false">列车</u-radio>
			</u-radio-group>
			<u-radio-group v-model="data_listContingency" style="height: 50px; width: 100%" placement="row">
				<text style="display: inline-block; line-height: 50px; margin-right: 39%">应急预案:</text>
				<u-radio :name="1" :disabled="false">启动</u-radio>
				<u-radio :name="2" :disabled="false">未启</u-radio>
			</u-radio-group>
			<u-radio-group v-model="data_listMisinfor" style="height: 50px; width: 100%" placement="row">
				<text style="display: inline-block; line-height: 50px; margin-right: 47%">误报标识:</text>
				<u-radio :name="1" :disabled="false">是</u-radio>
				<u-radio :name="2" :disabled="false">否</u-radio>
			</u-radio-group>
			
			<view class="fault-phenomenon">
				<view class="fault-phenomenon-title">
					<view style="text-align: left"><b>问题现象详细描述：</b></view>
					<view @click="handleAdd">新增</view>
				</view>
				<view v-for="(symptomItem, index) in faultSymptomList" :key="'symptom' + index"
					class="fault-phenomenon-item">
					<view class="phenomenon-top">
						<view @click="faultSymptomList.splice(index, 1)">删除</view>
					</view>
					<u-cell-group>
						<u-cell-item title="填报时间:" :value="symptomItem.createTime" :arrow="false"></u-cell-item>
						<u-cell-item title="填  写 人:" :value="symptomItem.fillUser" :arrow="false"></u-cell-item>
					</u-cell-group>
					<view class="job-detail">内容：</view>
					<view class="text">{{ symptomItem.content }}</view>
				</view>
				<view v-for="(symptomItem, index) in faultSymptomListAdd" :key="index" class="fault-phenomenon-item">
					<view class="phenomenon-top">
						<view @click="faultSymptomListAdd.splice(index, 1)">删除</view>
					</view>
					<u-cell-group>
						<u-cell-item title="填报时间:" :value="
                symptomItem.createTime == '' ? '请选择' : symptomItem.createTime
              " @click="
                show_date = true;
                date_type = { type: 'symptomItemCreateTime', index: index };
              ">
						</u-cell-item>
						<u-field v-model="symptomItem.fillUser" label="填  写 人:" placeholder="请填写"></u-field>
					</u-cell-group>
					<view class="job-detail">内容：</view>
					<textarea class="text" v-model="symptomItem.content"></textarea>
				</view>
			</view>

			<view class="fault-major">
				<view class="fault-major-title">
					<view style="text-align: left"><b>所属专业系统</b></view>
					<view @click="show_system = true">新增</view>
				</view>
				<view v-for="(systemItem, index) in faultSystemList" :key="index" class="fault-major-item">
					<view class="major-top">
						<view>{{ systemItem.owner }}</view>
						<!-- <view>删除</view> -->
					</view>
					<u-cell-group>
						<u-cell-item title="所属:" :value="systemItem.owner" :arrow="false"></u-cell-item>
						<u-cell-item title="单位:" :value="systemItem.systemName" :arrow="false"></u-cell-item>
						<u-cell-item title="设备:" :value="systemItem.deviceName" :arrow="false"></u-cell-item>
						<u-cell-item title="设备等级:" :value="systemItem.devicelevel" :arrow="false"></u-cell-item>
						<u-cell-item title="设备数量:" :value="systemItem.refernum" :arrow="false"></u-cell-item>
					</u-cell-group>
				</view>
				<!-- <view v-for="(systemItem, index) in faultSystemList" :key="index" class="fault-major-item">
					<view class="major-top">
						<view>{{systemItem.owner}}</view>
						<view>删除</view>
					</view>
					<u-cell-group>
						<u-cell-item title="所属:" :value="systemItem.owner" :arrow="false"></u-cell-item>
						<u-cell-item title="单位:" :value="systemItem.systemName" :arrow="false"></u-cell-item>
						<u-cell-item title="设备:" :value="systemItem.deviceName" :arrow="false"></u-cell-item>
						<u-cell-item title="设备等级:" :value="systemItem.devicelevel" :arrow="false"></u-cell-item>
						<u-field v-model="systemItem.refernum" label="设备数量:" placeholder="请输入"></u-field>
					</u-cell-group>
				</view> -->
			</view>

			<view class="job-detail">备注及其它：</view>
			<textarea class="text" v-model="data_list.remark"></textarea>

			<view class="btn" v-if="taskId != ''">
				<!-- 1：部门，2：车间，3：班组 4:总工办 5：维调 -->
				<button class="default-btn" @click="pushData()" v-if="show_check != ''">
					提交问题单
				</button>
				<!-- <button
          class="default-btn"
          @click="showCloseLoopModal"
          v-if="assign == 5"
        >
         
          非问题，结束
        </button> -->
				<button class="default-btn" v-show="checkOperationDefine('Report')" v-if="
            assign != 1 &&
            assign != 5 &&
            (fixStatus == 1 || fixStatus == 2 || fixStatus == 4)
          " @click="departmentOpen">
					上报
				</button>
				<!-- v-if="assign == 1 || assign == 2 || assign == 3" -->
				<button class="default-btn" v-show="checkOperationDefine('ReportWD')" v-if="
            assign != 5 && (fixStatus == 1 || fixStatus == 2 || fixStatus == 4)
          " @click="doReport('/fault/doReportWD')">
					上报维调
				</button>
				<!-- <button class="default-btn" v-if="assign == 1 || assign == 2 || assign == 3" @click="doApprove()">
					发起问题维修单
				</button> -->
				<!-- v-if="assign == 1 || assign == 2 || assign == 3" -->
				<button class="default-btn" v-show="checkOperationDefine('EndProcess')"
					v-if="fixStatus == 4 && !hasReportFlag" @click="showCloseLoopModal">
					问题闭环
				</button>
				<!-- <button class="default-btn" style="width: 100%; margin-left: 0"
					v-if="assign == 1 || assign == 2 || assign == 3" @click="blockSave()">
					发起问题单延期处理
				</button> -->
			</view>
			<!-- 	<view class="btn" v-if="this.cao == 3">
				<button class="default-btn" @click="pushData()">提交问题单</button>
				<button class="default-btn" @click="endProcessClick()">
					非问题，结束
				</button>
			</view> -->
		</view>

		<view class="detail circulation" v-show="tab == 1">
			<view class="ac tab" style="padding-top: 20px">
				<view class="type" :class="{ on: tab == 0 }" @click="tab = 0">问题单信息</view>
				<view class="type" :class="{ on: tab == 1 }" @click="tab = 1">流转信息</view>
			</view>
			<view v-for="(item, index) in circulationList" :key="index" class="fault-circulation-item">
				<text>序号：{{ index + 1 }}</text>
				<u-cell-group>
					<u-cell-item title="操作部门:" :value="item.orgName" :arrow="false"></u-cell-item>
					<u-cell-item title="操作人:" :value="item.assigneeName" :arrow="false"></u-cell-item>
					<u-cell-item title="操作时间:" :value="item.claimtime" :arrow="false"></u-cell-item>
					<u-cell-item title="操作类型:" :value="item.name" :arrow="false"></u-cell-item>
					<!-- <u-cell-item title="下一节点:" :value=" ''" :arrow="false"></u-cell-item> -->
				</u-cell-group>
				<view class="job-detail">处理意见：</view>
				<view class="text">{{ item.message }}</view>
				<!-- <textarea class="text" v-model="item.message"></textarea> -->
			</view>
		</view>

		<view class="full" v-show="show_picker || show_date"></view>
		<u-picker v-model="show_date" mode="time" :params="params" @confirm="setDate" @cancel="onCancel"></u-picker>
		<u-select v-show="!isAuto" v-model="show_picker" :list="columns" label-name="text" @confirm="onConfirm"
			@cancel="onCancel">
		</u-select>

		<u-select v-show="isAuto" v-model="show_picker" :list="columns" mode="mutil-column-auto" label-name="title"
			@confirm="onConfirm" @cancel="onCancel">
		</u-select>
		<System v-if="show_system" :faultSystemList="faultSystemList" @close="closeSystem" @setSystem="setSystem">
		</System>
		<SelectDep v-show="show_dep" :station="dep_options" @close="show_dep = false" @setDep="setDep"></SelectDep>
		<view class="full" v-show="show_station"></view>
		<selectDevice v-show="show_device" :deviceName="deviceName" :device="optionEquName" @close="show_device = false"
			@setDevice="setDevice"></selectDevice>
		<u-select v-model="show_picker1" :list="columns" :label-name="label_name" :value-name="value_name"
			@confirm="onConfirm" @cancel="onCancel">
		</u-select>
		<SelectStation v-show="show_station" :stationName="stationName" :faultStatus="data_listFaultstatus"
			:station="station_options" @close="show_station = false" @setStation="setStation"></SelectStation>
		<PeopleSelect v-if="show_people" :people="leaderOptions" :peopleName="data_list.discoverer"
			@setPeople="setPeople" :faultStatus='1' @close="show_people=false"> </PeopleSelect>
		<view class="no-edit" v-if="taskId == ''"></view>
	</view>
</template>

<script>
	import {
		EQUCONTROLLER
	} from '../../api/eqt.js'
	import {
		PMS_DICT_CONTROLLER,
		WORK_CONTROLLER
	} from "../../api/pms";
	import SelectStation from "../../components/faultClosedLoop/selectStation";
	import SelectDep from "../../components/faultClosedLoop/selectDep.vue";
	import System from "../../components/faultClosedLoop/system.vue";
	import selectDevice from '../../components/myWork/viewWork/selectDevice.vue'
	import PeopleSelect from "../../components/faultClosedLoop/peopleSelect.vue"
	import {
		mapState
	} from "vuex";
	export default {
		components: {
			System,
			SelectDep,
			SelectStation,
			selectDevice,
			PeopleSelect
		},

		computed: {
			...mapState([
				"fault"

			]),
		},
		data() {
			return {
				label_name: "",
				value_name: "",
				show_station: false,
				show_check: "",
				hasReportFlag: false,
				departmentTag: false,
				department: [],
				reportDep_name: "",
				taskName: "",
				faultModalSelList: [],
				faultList: [{
						id: "faultornon",
						checked: false,
						label: "隐患",
					},
					{
						id: "misinfor",
						checked: false,
						label: "误报",
					},
					{
						id: "waterleakage",
						checked: false,
						label: "结构渗漏水",
					},
					{
						id: "delayfault",
						checked: false,
						label: "运营晚点事件",
					},
					{
						id: "stopwater",
						checked: false,
						label: "停供水事件",
					},
					{
						id: "failcontrolpower",
						checked: false,
						label: "变电所开关设备远程失败事件",
					},
				],
				show_modal: false,
				report_dep_options: [],
				show_dep: false,
				isAuto: "",
				detailID: "",
				taskId: "",
				processInstanceId: "",
				woId: "",
				tab: 0,
				cao: 0,
				circulationList: [],
				lineName: "",
				line_options: "",
				dutyOrgName: "",
				dutyOrg_options: "",
				stationName: "",
				station_options: [{
					text: "无数据",
					value: "",
					extra: {
						type: "",
						id: "",
					},
				}, ],
				faultLevelName: "",
				faultLevel_options: [{
						text: "一类问题",
						value: "1",
						extra: {
							type: "faultlevel",
						},
					},
					{
						text: "二类问题",
						value: "2",
						extra: {
							type: "faultlevel",
						},
					},
					{
						text: "三类问题",
						value: "3",
						extra: {
							type: "faultlevel",
						},
					},
					{
						text: "四类问题",
						value: "4",
						extra: {
							type: "faultlevel",
						},
					},
				],
				reportDep_options: [],
				trans_options: [],
				dep_options: [],
				params: {
					year: true,
					month: true,
					day: true,
					hour: true,
					minute: true,
					second: true,
				},
				columns: [],
				data_listFaultstatus: "",
				data_listContingency: "",
				data_listMisinfor: "",
				faultSymptomList: [],
				faultSymptomListAdd: [],
				faultSystemList: [],
				data_list: {
					dealContent: "",
					message: "",
					orgIds: "",
					reason: "",
					receiveTime: "",
					lineId: "",
					faultLocation: [""],
					createName: "",
					discoverer: "",
					contactPhone: "",
					faultStartTime: "",
					faultLevel: "",
					dutyOrg: null,
					limitTime: "",
					faultstatus: "",
					contingency: "",
					misinfor: "",
					remark: "",
					faultSystemList: [],
					id: "",
					faultIssue: "",
					subType: 1,
					equName: "",
					equId: "",
					equTypeId: "",
					equTypeName: ""
				},
				operationDefineList: [],
				org_name: "",
				fixStatus: "",
				assign: 0, //1部门，2车间，3班组，5维调
				show_system: false,
				date_type: true,
				show_picker: false,
				show_date: false,
				show_station: false,
				show_device: false,
				show_people: false,
				show_picker1: false,
				selece_type: "",
				deviceName: "",
				optionEqu: [],
				optionEquName: [],
				stationGroup: [],
				leaderOptions: [],
				faultAddIndex: '',
			};
		},
		onLoad(options) {
			if (!options || !options.params) return;
			let routeParams = JSON.parse(options.params);
			// console.log(this.$mp.page.route);
			this.detailID = routeParams.id;
			this.taskId = routeParams.taskId || "";
			this.processInstanceId = routeParams.processInstanceId || "";
			this.woId = routeParams.woId || "";
			this.cao = routeParams.tab || 0;
			this.taskName = routeParams.taskName;
			this.loadCurrentTask();
			this.checkRepairStatus();
		},
		created() {
			this.initDetailData();
			this.initOptions();
			this.getTransfor();
			this.getAssign();
			this.getOnlySubOrgList();
			this.findReportDepTree();
			this.getNameByOrgId()
		},
		onBackPress(e) {
			uni.switchTab({
				url: "/pages/faultClosedLoop/toHandle",
			});
		},

		methods: {
			checkReson(param) {
				if (param === 'old') {
					this.selece_type = "reason"
				} else {
					this.faultAddIndex = param
					this.selece_type = "reason1"
				}
				this.columns = this.fault
				this.label_name = 'value'
				this.value_name = "code"
				this.show_picker1 = true

			},
			setPeople(obj) {
				this.data_list.discoverer = obj.name.toString();
				// this.listOrderData.constructPerson = obj.id.toString();
				let leaderId = obj.id.toString()
				let filterPeople = this.leaderOptions.filter(item => item.idK == leaderId)
				this.data_list.contactPhone = filterPeople[0]?.phone
				this.show_people = false;
			},
			getNameByOrgId() {
				this.fetch(
					"get",
					this.$store.state.baseUrl + WORK_CONTROLLER.GET_NAME_BY_ORGID, {
						num: ''
					}
				).then((res) => {
					if (res?.success) {
						this.leaderOptions = res?.data;
					}
				});

			},
			filterStation() {
				if (this.data_listFaultstatus == 1) {
					this.stationGroup.forEach(item => {
						let type = item.type.split('-')
						if (type[1] == '车站') {
							this.station_options = item.station
						}
					})
				}
				if (this.data_listFaultstatus == 2) {
					this.stationGroup.forEach(item => {
						let type = item.type.split('-')
						if (type[1] == '区间') {
							this.station_options = item.station
						}
					})
				}
			},
			setDevice(obj) {
				this.data_list.equName = obj.name.toString();
				this.data_list.equId = obj.id.toString();
				this.show_device = false;
			},
			getEquTypeByStationId(param) {
				if (this.data_list.faultLocation.length == 0) {
					uni.showToast({
						title: "请先选择问题地点~",
						icon: "none",
					});
					return
				}
				this.columns = []
				this.fetch(
					"GET",
					this.$store.state.baseUrl + EQUCONTROLLER.GET_EQU_TYPE_BY_STATIONID, {
						stationId: this.data_list.faultLocation.toString(),
					}, false
				).then((res) => {
					if (res.returnCode == 2004) {
						this.selece_type = 'equTypeName'
						this.label_name = 'name'
						this.value_name = 'idk'
						this.columns = res?.data
						console.log('this.columns', this.columns)
						this.show_picker1 = true
					}
				})
			},
			/**
			 * 根据选择的设备类型获取 设备列表 
			 */
			async getEquList() {
				this.fetch(
					"post",
					this.$store.state.baseUrl + WORK_CONTROLLER.POST_EQU_EQULIST, {
						equtype: this.data_list.equTypeId,
						stationId: this.data_list.faultLocation.toString(),
						page: 1,
						size: 9999999,
					}, false
				).then((res) => {
					if (res?.data) {
						this.optionEquName = res?.data?.content;
						this.optionEquName = this.reduceArray(this.optionEquName, "idk");
						console.log('this.optionEquName', this.optionEquName, res?.data?.content)
					}
				})
			},
			// 数组对象元素去重
			reduceArray(initialArr, attr) {
				// const uniqueArr = Array.from(new Set(arr.map(JSON.stringify)), JSON.parse);
				let uniqueArr = initialArr.reduce((acc, obj) => {
					let existingObj = acc.find((item) => item[attr] === obj[attr]);
					if (!existingObj) {
						acc.push(obj);
					}
					return acc;
				}, []);
				return uniqueArr;
			},
			setStation(obj) {
				this.stationName = obj.name.toString();
				this.data_list.faultLocation = obj.id;
				this.show_station = false;
			},
			mapTree(org) {
				const haveChildren =
					Array.isArray(org.children) && org.children.length > 0;
				return {
					id: org.id,
					label: org.title,
					openTag: false,
					choose: false,
					children: haveChildren ? org.children.map((i) => this.mapTree(i)) : [],
				};
			},
			// 所属部门 - 打开
			departmentOpen() {
				if (this.fixStatus == 1 || this.fixStatus == 3 || this.fixStatus == 2) {
					uni.showToast({
						title: "该问题单存在维修工单，请移至管理端进行维修工单确认",
						icon: "none",
					});
					return;
				}
				if (!this.data_list.reason) {
					uni.showToast({
						title: "请填写原因概述",
						icon: "none",
					});
					return;
				}
				let temp = this.report_dep_options;
				let result = temp.map((org) => this.mapTree(org));
				// console.log(result);
				this.department = result;
				this.departmentTag = true;
			},
			// 所属部门 - 关闭
			closeTree() {
				this.departmentTag = false;
			},
			// 所属部门 - 获取
			// ids: 集合
			// items: 节点对象集合
			getDepartmentValue(ids, items) {
				this.data_list.orgIds = ids[ids.length - 1];
				setTimeout(() => {
					this.doReport("/fault/doReport", "report");
				}, 500);
				// let str = '';
				// items.forEach((item, i) => {
				// 	str += item.label + "-";
				// });
				// this.departmentName = str.substring(0, str.length - 1);
			},
			checkRepairStatus() {
				this.fetch(
					"GET",
					this.$store.state.baseFaultUrl +
					"/faultFix/checkRepairStatus/" +
					this.detailID, {},
					false,
					this.$store.state.faultCLHeader
				).then((res) => {
					if (res.success) {
						if (res.data) {
							this.fixStatus = res.data;
						}
					}
				});
			},

			checkboxGroupChange(e) {
				this.faultModalSelList = e;
			},
			setDep(obj) {
				this.org_name = obj.name.toString();
				this.data_list.orgIds = obj.id;
				this.show_dep = false;
			},
			findReportDepTree() {
				this.fetch(
					"GET",
					this.$store.state.baseFaultUrl + "/kunmingdict/org/findReportTree", {},
					false,
					this.$store.state.faultCLHeader
				).then((res) => {
					if (res.success) {
						if (res.data) {
							let temp = res.data;
							temp.map((item) => {
								item.extra = {
									type: "org",
									checked: false,
									id: item.id,
								};
								item.text = item.title;
							});
							this.report_dep_options = temp;
						}
					}
				});
			},
			getOnlySubOrgList() {
				this.fetch(
					"GET",
					this.$store.state.baseFaultUrl + "/kunmingdict/org/findChildrenOrgs", {},
					false,
					this.$store.state.faultCLHeader
				).then((res) => {
					if (res.success) {
						if (res.data) {
							let temp = res.data;
							temp.map((item) => {
								item.extra = {
									type: "org",
									checked: false,
									id: item.id,
								};
								item.text = item.title;
							});
							this.dep_options = temp;
						}
					}
				});
			},
			checkOperationDefine(type) {
				return this.operationDefineList.indexOf(type) > -1;
			},
			loadCurrentTask() {
				if (this.taskId) {
					this.fetch(
						"GET",
						this.$store.state.baseFaultUrl + "/task/findTaskDetail", {
							actTaskId: this.taskId,
						},
						false,
						this.$store.state.faultCLHeader
					).then((res) => {
						if (res.success) {
							if (res.data) {
								let currentTask = res.data[0];
								this.show_check = res.data[0].assigneeName;
								currentTask.operationDefines.forEach((item) => {
									this.operationDefineList.push(item.displayNameEn);
								});
							}
						}
					});

					this.fetch(
						"POST",
						this.$store.state.baseFaultUrl + "/fault/checkHasReport", {
							taskId: this.taskId,
						},
						false
					).then((res) => {
						this.hasReportFlag = res.data;
					});
				}
			},
			// 新增问题现象
			handleAdd() {
				this.faultSymptomListAdd.push({
					createTime: this.getNowDate(),
					fillUser: uni.getStorageSync("username"),
					content: "",
				});
			},
			back() {
				// this.$emit("todoHandle", true);
				uni.navigateBack();
			},
			getTransfor() {
				this.fetch(
					"GET",
					this.$store.state.baseFaultUrl +
					"/kunmingdict/org/findTransforTreeWithSelf", {},
					false,
					this.$store.state.faultCLHeader
				).then((res) => {
					if (res.success) {
						if (res.data) {
							// this.trans_options = res.data;
							// this.trans_options.map((item) => {
							// 	item.extra = {
							// 		type: "trans",
							// 		id: item.id,
							// 	};
							// 	item.text = item.title
							// });

							let temp = res.data;
							temp.map((item) => {
								item.extra = {
									type: "trans",
									id: item.id,
								};
								// item.text = item.title;
							});
							this.trans_options = this.deleteEmptyChildren(temp);
						}
					}
				});
			},
			getAssign() {
				this.fetch(
					"GET",
					this.$store.state.baseFaultUrl + "/fault/getAssign", {},
					false,
					this.$store.state.faultCLHeader
				).then((res) => {
					if (res.success) this.assign = res.data;
				});
			},
			unclaimTask() {
				this.fetch(
					"POST",
					this.$store.state.baseFaultUrl + "/workFlow/task/unclaimTask", {
						actTaskId: this.taskId,
					},
					false,
					this.$store.state.faultCLHeader
				).then((res) => {
					if (res.success) {
						uni.showToast({
							title: "取消领取成功",
							icon: "none",
						});
					} else {
						uni.showToast({
							title: res.message,
							icon: "none",
						});
					}
				});
			},
			onConfirm(item) {
				if (item[0]?.extra?.type == "line") {
					this.lineName = item[0].label;
					this.data_list.lineId = item[0].extra.id;
					this.getStationOption(this.data_list.lineId);
				} else if (item[0]?.extra?.type == "station") {
					this.stationName = item[0].label;
					this.data_list.faultLocation = [item[0].extra.id];
				} else if (item[0]?.extra?.type == "faultlevel") {
					this.faultLevelName = item[0].label;
					this.data_list.faultLevel = item[0].value;
				} else if (item[0]?.extra?.type == "dutyOrg") {
					if (item.length == 1) {
						this.dutyOrgName = item[0].label;
						this.data_list.dutyOrg = item[0].extra.id;
					} else {
						let itStr = "";
						item.forEach((it) => {
							itStr += "/" + it.label;
						});
						this.dutyOrgName = itStr.slice(1);
						this.data_list.dutyOrg = item[1].value;
					}
				} else if (item[0]?.extra?.type == "trans") {
					if (item.length == 1) {
						this.org_name = item[0].label;
						this.data_list.orgIds = item[0].extra.id;
					} else {
						let itStr = "";
						item.forEach((it) => {
							itStr += "/" + it.label;
						});
						this.org_name = itStr.slice(1);
						this.data_list.orgIds = item[1].value;
					}
				} else if (item[0]?.extra?.type == "reportDep") {
					console.log(item);
					if (item.length == 1) {
						this.reportDep_name = item[0].label;
						this.data_list.orgIds = item[0].extra.id;
					} else {
						let itStr = "";
						item.forEach((it) => {
							itStr += "/" + it.label;
						});
						this.reportDep_name = itStr.slice(1);
						this.data_list.orgIds = item[item.length - 1].value;
					}
					setTimeout(() => {
						this.doReport("/fault/doReport", "report");
					}, 500);
				} else if (this.selece_type == 'equTypeName') {
					this.data_list.equTypeName = item[0].label
					this.data_list.equTypeId = item[0].value
					this.getEquList()
				} else if (this.selece_type == 'people') {
					this.data_list.discoverer = item[0].label
					let leaderId = item[0].value
					let filterPeople = this.leaderOptions.filter(item => item.idK == leaderId)
					this.data_list.contactPhone = filterPeople[0]?.phone
				} else if (this.selece_type == 'reason') {
					this.data_list.faultItem = item[0].label
				}
				this.onCancel();
			},
			onCancel() {
				this.show_picker = false;
				this.show_date = false;
				this.show_picker1 = false
			},
			setDate(obj) {
				let str =
					obj.year +
					"-" +
					obj.month +
					"-" +
					obj.day +
					" " +
					obj.hour +
					":" +
					obj.minute +
					":" +
					obj.second;

				if (typeof this.date_type == "string") {
					switch (this.date_type) {
						case "receiveTime":
							this.data_list.receiveTime = str;
							break;
						case "faultStartTime":
							this.data_list.faultStartTime = str;
							break;
						case "limitTime":
							this.data_list.limitTime = str;
							break;
						default:
					}
				} else {
					switch (this.date_type.type) {
						case "symptomItemCreateTime":
							this.faultSymptomListAdd[this.date_type.index].createTime = str;
							break;
						default:
					}
				}

				this.onCancel();
			},
			initDetailData() {
				this.fetch(
					"GET",
					this.$store.state.baseFaultUrl + "/fault/get/" + this.detailID, {},
					false,
					this.$store.state.faultCLHeader
				).then((res) => {
					if (res.success) {
						this.data_list = (({
							dealContent,
							message,
							orgIds,
							reason,
							receiveTime,
							lineId,
							faultLocation,
							createName,
							discoverer,
							contactPhone,
							faultStartTime,
							faultLevel,
							dutyOrg,
							limitTime,
							faultstatus,
							contingency,
							misinfor,
							remark,
							equName,
							equId,
							equTypeName,
							equTypeId,
							faultSymptomList,
							faultItem
						}) => ({
							dealContent,
							message,
							orgIds,
							reason,
							receiveTime,
							lineId,
							faultLocation,
							createName,
							discoverer,
							contactPhone,
							faultStartTime,
							faultLevel,
							dutyOrg,
							limitTime,
							faultstatus,
							contingency,
							misinfor,
							remark,
							equName,
							equId,
							equTypeName,
							equTypeId,
							faultSymptomList,
							faultItem
						}))(res.data);

						this.faultSymptomList = res.data.faultSymptomList;
						this.faultSystemList = res.data.faultSystemList;

						this.lineName = res.data.lineName;
						this.stationName = res.data.faultLocationName;
						this.faultLevelName = res.data.faultLevel ?
							res.data.faultLevel + "类问题" :
							"";
						this.dutyOrgName = res.data.dutyOrgName;
						this.data_listFaultstatus = ["车站", "区间", "列车"].indexOf(this.data_list.faultstatus) + 1 ||
							"";

						this.data_listContingency = ["Y", "N"].indexOf(this.data_list.contingency) + 1 || "";
						this.data_listMisinfor = ["Y", "N"].indexOf(this.data_list.misinfor) + 1 || "";
						this.$nextTick(() => {
							this.getFaultPosAndAssign(res.data.lineId, res.data.faultLocation);
							this.lineName = res.data.lineName;
							this.stationName = res.data.faultLocationName;
						});
					}
				});
				this.fetch(
					"GET",
					this.$store.state.baseFaultUrl + "/task/loadRelationTaskList", {
						actTaskId: this.taskId,
						procInstId: this.processInstanceId,
					},
					false,
					this.$store.state.faultCLHeader
				).then((res) => {
					if (res.success) {
						this.circulationList = res.data.rows;
					}
				});
			},
			initOptions() {
				this.fetch(
					"GET",
					this.$store.state.baseFaultUrl + "/kunmingdict/line/name", {
						status: "",
					},
					true,
					this.$store.state.faultCLHeader
				).then((res) => {
					if (res.success) {
						this.line_options = res.data;
						this.line_options.map((item) => {
							item.extra = {
								type: "line",
								id: item.id,
							};
							item.text = item.name;
						});
					}
				});
				this.fetch(
					"GET",
					this.$store.state.baseFaultUrl +
					"/kunmingdict/org/findChildrenOrgsWithSelf", {},
					true,
					this.$store.state.faultCLHeader
				).then((res) => {
					if (res.success) {
						let temp = res.data;
						temp.map((item) => {
							item.extra = {
								type: "dutyOrg",
								id: item.id,
							};
							// item.text = item.title;
						});
						this.dutyOrg_options = this.deleteEmptyChildren(temp);
					}
				});
			},
			// 清除空的children
			deleteEmptyChildren(arr) {
				let childs = arr;
				for (let i = childs.length; i--; i > 0) {
					if (childs[i].children) {
						if (childs[i].children.length) {
							this.deleteEmptyChildren(childs[i].children);
						} else {
							delete childs[i].children;
						}
					}
				}
				return arr;
			},
			getFaultPosAndAssign(lineId, selArr) {
				if (this.data_listFaultstatus == 3) {
					this.fetch(
						"GET",
						this.$store.state.baseFaultUrl + "/pmsDict/train/getNameByLineId", {
							lineId: lineId,
						},
						false,
						this.$store.state.faultCLHeader
					).then((res) => {
						if (res.success) {
							this.station_options = res.data || []; //暂时特殊处理
							this.station_options.map((item) => {
								let flag = selArr.indexOf(item.id);
								item.extra = {
									type: "station",
									checked: flag != -1 ? true : false,
									id: item.id,
								};
								item.checked = flag != -1 ? true : false;
								item.text = item.name;
							});
						}
					});
					return;
				} else {
					this.fetch(
						"GET",
						this.$store.state.baseFaultUrl + "/kunmingdict/station/nameGroupType", {
							lineIds: lineId,
						},
						false,
						this.$store.state.faultCLHeader
					).then((res) => {
						if (res.success) {
							let temp = [];
							res.data.forEach((item) => {
								temp = temp.concat(item.childs);
							});
							// this.station_options = res.data[0].childs || []; //暂时特殊处理
							temp.map((item) => {
								let flag = selArr.indexOf(item.id);
								item.extra = {
									type: "station",
									checked: flag != -1 ? true : false,
									id: item.id,
								};
								item.checked = flag != -1 ? true : false;
								item.text = item.name;
							});
							console.log(temp);
							this.station_options = temp;
						}
					});
				}
			},
			getStationOption() {
				if (this.data_listFaultstatus == 3) {
					this.fetch(
						"GET",
						this.$store.state.baseFaultUrl + "/pmsDict/train/getNameByLineId", {
							lineId: this.data_list.lineId,
						},
						false,
						this.$store.state.faultCLHeader
					).then((res) => {
						if (res.success) {
							this.station_options = res.data[0].childs || []; //暂时特殊处理
							this.station_options.map((item) => {
								item.extra = {
									type: "station",
									checked: false,
									id: item.id,
								};
								item.text = item.name;
							});
						}
					});
				} else {
					this.fetch(
						"GET",
						this.$store.state.baseFaultUrl + "/kunmingdict/station/nameGroupType", {
							lineIds: this.data_list.lineId,
						},
						false,
						this.$store.state.faultCLHeader
					).then((res) => {
						if (res.success) {
							let temp = [];
							res.data.forEach((item) => {
								temp = temp.concat(item.childs);
							});
							// this.station_options = res.data[0].childs || []; //暂时特殊处理
							temp.map((item) => {
								item.extra = {
									type: "station",
									checked: false,
									id: item.id,
								};
								item.text = item.name;
							});
							this.station_options = temp;
						} else {
							this.station_options = [];
						}
					});
				}
			},
			setSystem(arr) {
				let new_arr = [...arr];
				// new_arr.map((item) => {
				// 	item.system_name;
				// 	item.subsystem_name;
				// 	item.device_name;
				// 	item.child;
				// });
				this.data_list.faultSystemList = new_arr;
				this.faultSystemList = new_arr;
				this.show_system = false;
			},
			pushData() {
				if (this.checkInputNull() != "success") return;
				if (
					(this.taskName == "维调分派" || this.taskName == "维调验证销号") &&
					this.data_list.orgIds &&
					this.data_list.orgIds.length > 0
				) {
					this.doTransferWeidiao();
					return;
				}
				if (
					this.taskName == "问题处理" &&
					this.data_list.orgIds &&
					this.data_list.orgIds.length > 0
				) {
					this.doTransfer();
					return;
				}
				this.doSubmit();
			},
			doSubmit() {
				if (this.fixStatus == 1 || this.fixStatus == 3 || this.fixStatus == 2) {
					uni.showToast({
						title: "该问题单存在维修工单，请移至管理端进行维修工单确认",
						icon: "none",
					});
					return;
				}
				this.data_list.faultstatus =
					this.data_listFaultstatus == 1 ?
					"车站" :
					this.data_listFaultstatus == 2 ?
					"区间" :
					"列车";
				this.data_list.contingency = this.data_listContingency == 1 ? "Y" : "N";
				this.data_list.misinfor = this.data_listMisinfor == 1 ? "Y" : "N";
				this.data_list.subType = 1;
				this.data_list.id = this.detailID;

				this.data_list.faultSymptomParams = [
					...this.faultSymptomList,
					...this.faultSymptomListAdd,
				];
				this.data_list.faultSystemList = this.faultSystemList;
				//暂时特殊处理
				// this.data_list.ownerDepartment = "Y";
				// if (this.data_list.faultstatus == "区间")
				//   this.data_list.faultstatus = "车站";
				// this.data_list.faultIssue = "test";

				if (
					this.data_list.contactPhone &&
					!/^1[3|4|5|7|8]\d{9}$/.test(this.data_list.contactPhone)
				)
					return uni.showToast({
						title: "手机号码有误，请重填",
						icon: "none",
					});
				if (
					new Date(this.data_list.faultStartTime).getTime() >
					new Date(this.data_list.receiveTime).getTime()
				)
					return uni.showToast({
						title: "问题开始时间不能晚于接报时间",
						icon: "none",
					});
				if (
					this.data_list.faultstatus == "区间" &&
					this.data_list.faultLocation.length != 2
				)
					return uni.showToast({
						title: "请选择两个站点~",
						icon: "none",
					});
				this.fetch(
					"POST",
					this.$store.state.baseFaultUrl + "/fault/update",
					this.data_list,
					false,
					this.$store.state.faultCLHeader
				).then((res) => {
					if (res.success) {
						uni.showToast({
							title: "提交成功",
							icon: "none",
						});
						setTimeout(() => {
							// this.back();
							uni.navigateTo({
								url: "/pages/index/index",
							});
						}, 800);
					} else {
						uni.showToast({
							title: "服务端提示：" + res.message,
							icon: "none",
						});
					}
				});
			},
			doTransferWeidiao() {
				let params = {
					taskId: this.taskId,
					orgIds: this.data_list.orgIds,
					verify: false,
					limitTime: this.data_list.limitTime,
					reason: this.data_list.reason,
					message: this.data_list.message,
					dealContent: this.data_list.dealContent,
				};
				this.fetch(
					"POST",
					this.$store.state.baseFaultUrl + "/fault/transferWeiDiao",
					params,
					false,
					this.$store.state.faultCLHeader
				).then((res) => {
					if (res.success) {
						uni.showToast({
							title: "转派完成",
							icon: "none",
						});
						setTimeout(() => {
							this.doSubmit();
						}, 500);
					} else {
						uni.showToast({
							title: "服务端提示：" + res.message,
							icon: "none",
						});
					}
				});
			},
			doTransfer() {
				let params = {
					taskId: this.taskId,
					orgIds: [this.data_list.orgIds || ""],
					verify: false,
					limitTime: this.data_list.limitTime,
					reason: this.data_list.reason,
					dealContent: this.data_list.dealContent,
				};
				this.fetch(
					"POST",
					this.$store.state.baseFaultUrl + "/fault/transfer",
					params,
					false,
					this.$store.state.faultCLHeader
				).then((res) => {
					if (res.success) {
						uni.showToast({
							title: "转派完成",
							icon: "none",
						});
						setTimeout(() => {
							this.doSubmit();
						}, 500);
					} else {
						uni.showToast({
							title: "服务端提示：" + res.message,
							icon: "none",
						});
					}
				});
			},
			checkInputNull() {
				if (this.data_list.receiveTime == "")
					return uni.showToast({
						title: "接报时间不能为空",
						icon: "none",
					});
				if (this.data_list.faultStartTime == "")
					return uni.showToast({
						title: "问题开始时间不能为空",
						icon: "none",
					});
				if (this.data_list.lineId == "")
					return uni.showToast({
						title: "线路不能为空",
						icon: "none",
					});
				if (this.data_list.faultLocation[0] == "")
					return uni.showToast({
						title: "问题地点不能为空",
						icon: "none",
					});
				if (this.data_list.discoverer == "")
					return uni.showToast({
						title: "发现人不能为空",
						icon: "none",
					});
				// if (this.data_list.contactPhone == "")
				// 	return uni.showToast({
				// 		title: "发现人电话不能为空",
				// 		icon: "none",
				// 	});
				if (this.data_listFaultstatus == "")
					return uni.showToast({
						title: "问题位置不能为空",
						icon: "none",
					});
				if (this.faultSystemList.length == 0)
					return uni.showToast({
						title: "所属专业不能为空",
						icon: "none",
					});
				return "success";
			},
			doReport(path, str) {
				if (this.fixStatus == 1 || this.fixStatus == 3 || this.fixStatus == 2) {
					uni.showToast({
						title: "该问题单存在维修工单，请移至管理端进行维修工单确认",
						icon: "none",
					});
					return;
				}

				if (!this.data_list.reason) {
					uni.showToast({
						title: "请填写原因概述",
						icon: "none",
					});
					return;
				}
				this.doSubmit();
				let params = {
					taskId: this.taskId,
					orgIds: [this.data_list.orgIds || ""],
					approveFlag: true,
					message: this.data_list.message,
					limitTime: this.data_list.limitTime,
					waterleakage: "N",
					delayfault: "N",
					stopwater: "N",
					failcontrolpower: "N",
					misinfor: "N",
					faultornon: "N",
					reason: this.data_list.reason,
					dealContent: this.data_list.dealContent,
				};
				this.fetch(
					"POST",
					this.$store.state.baseFaultUrl + path,
					params,
					false,
					this.$store.state.faultCLHeader
				).then((res) => {
					if (res.success) {
						uni.showToast({
							title: str ? "上报成功" : "上报维调完成",
							icon: "none",
						});

						setTimeout(() => {
							// this.back();
							uni.navigateTo({
								url: "/pages/index/index",
							});
						}, 800);
					} else {
						uni.showToast({
							title: "服务端提示：" + res.message,
							icon: "none",
						});
					}
				});
			},
			// blockSave() {
			//   let params = {
			//     taskId: this.taskId,
			//     faultId: this.detailID,
			//     faultWoid: this.woId,
			//     id: "",
			//     applytype: 1,
			//     blockuntil: this.data_list.limitTime,
			//     applydep: this.data_list.dutyOrg,
			//     applyreason: 1,
			//     otherreason: "",
			//     issue: "",
			//     currentstate: "",
			//     plan: "",
			//     cooDep: "",
			//   };
			//   this.fetch(
			//     "POST",
			//     this.$store.state.baseFaultUrl + "/fault/block/save",
			//     params,
			//     false,
			//     this.$store.state.faultCLHeader
			//   ).then((res) => {
			//     if (res.success) {
			//       uni.showToast({
			//         title: "发起延时审批按钮~",
			//         icon: "none",
			//       });
			//       setTimeout(() => {
			//         // this.back();

			//         uni.navigateTo({
			//           url: "/pages/index/index",
			//         });
			//       }, 800);
			//     } else {
			//       uni.showToast({
			//         title: "服务端提示：" + res.message,
			//         icon: "none",
			//       });
			//     }
			//   });
			// },
			// doApprove() {
			//   let params = {
			//     taskId: this.taskId,
			//     orgIds: this.data_list.orgIds,
			//     approveFlag: true,
			//     message: this.data_list.message,
			//     limitTime: this.data_list.limitTime,
			//     waterleakage: "N",
			//     delayfault: "N",
			//     stopwater: "N",
			//     failcontrolpower: "N",
			//     misinfor: "N",
			//     faultornon: "N",
			//     reason: this.data_list.reason,
			//     dealContent: this.data_list.dealContent,
			//   };
			//   this.fetch(
			//     "POST",
			//     this.$store.state.baseFaultUrl + "/fault/block/approve",
			//     params,
			//     false,
			//     this.$store.state.faultCLHeader
			//   ).then((res) => {
			//     if (res.success) {
			//       uni.showToast({
			//         title: "发起问题维修单~",
			//         icon: "none",
			//       });
			//       setTimeout(() => {
			//         // this.back();

			//         uni.navigateTo({
			//           url: "/pages/index/index",
			//         });
			//       }, 800);
			//     } else {
			//       uni.showToast({
			//         title: "服务端提示：" + res.message,
			//         icon: "none",
			//       });
			//     }
			//   });
			// },
			showCloseLoopModal() {
				this.show_modal = true;
			},
			clearModal() {
				let temp = this.faultList;
				temp.forEach((item) => {
					item.checked = false;
				});
				this.faultList = temp;
				this.faultModalSelList = [];
			},
			handleModalCancel() {
				this.clearModal();
				this.show_modal = false;
			},
			handleModalConfirm() {
				if (this.fixStatus == 1 || this.fixStatus == 2 || this.fixStatus == 3) {
					uni.showToast({
						title: "该问题单存在维修工单，请移至管理端进行维修工单确认",
						icon: "none",
					});
					return;
				}
				if (this.faultModalSelList == 0) {
					this.$refs.uModal.clearLoading();
					return uni.showToast({
						title: "请勾选闭环选项",
						icon: "none",
					});
				}
				this.endProcessClick();
			},
			endProcessClick() {
				if (this.fixStatus == 1 || this.fixStatus == 2 || this.fixStatus == 3) {
					uni.showToast({
						title: "该问题单存在维修工单，请移至管理端进行维修工单确认",
						icon: "none",
					});
					return;
				}

				let params = {
					taskId: this.taskId,
					approveFlag: true,
					reason: this.data_list.reason,
					dealContent: this.data_list.dealContent,
					message: this.data_list.message,
				};
				// console.log(this.faultModalSelList);
				this.faultList.forEach((i) => {
					params[i.id] =
						this.faultModalSelList.findIndex((item) => i.label == item) == -1 ?
						"N" :
						"Y";
				});

				this.fetch(
					"POST",
					this.$store.state.baseFaultUrl + "/fault/stopProcess",
					params,
					false,
					this.$store.state.faultCLHeader
				).then((res) => {
					if (res.success) {
						uni.showToast({
							title: "问题闭环~",
							icon: "none",
						});
						setTimeout(() => {
							// this.back();
							this.doSubmit();
							uni.navigateTo({
								url: "/pages/index/index",
							});
						}, 800);
					} else {
						uni.showToast({
							title: "服务端提示：" + res.message,
							icon: "none",
						});
					}
					this.show_modal = false;
					this.clearModal();
				});
			},
			closeSystem() {
				this.show_system = false;
			},
		},
	};
</script>

<style scoped>
	.btn .default-btn:nth-child(even) {
		margin-left: 20%;
	}

	.no-edit {
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 100vh;
		background: transparent;
		z-index: 100;
	}
</style>

<style lang="less" scoped>
	.app-title {
		position: relative;
		z-index: 200;
	}

	.detail>.tab {
		margin-top: 15px;
		position: relative;
		z-index: 200;
	}

	.detail>.tab>.type {
		line-height: 40px;
		font-size: 14px;
		color: #307be0;
		background: #fff;
		width: 120px;
		border: 1px solid #307be0;
		display: inline-block;
	}

	.detail>.tab>.on {
		background: #307be0;
		color: #fff;
		border: 1px solid transparent;
	}

	.detail {
		height: auto;
		padding-bottom: 16px;
		margin-top: -170px;
	}

	.job-detail {
		line-height: 45px;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		padding-right: 20px;
	}

	.detail .text {
		background: #f9fbfe;
		border: 1px solid #f1f1f1;
		border-radius: 6px;
		padding: 10px;
		font-size: 14px;
		height: 104px;
		overflow: auto;
	}

	.detail>.photo {
		overflow-x: auto;
		width: 100%;
		height: 100px;
		white-space: nowrap;
	}

	.detail>.photo>.img-item {
		width: 80px;
		height: 80px;
		margin-right: 10px;
		border-radius: 6px;
		display: inline-block;
		vertical-align: middle;
	}

	.detail>.btn {
		margin: 30rpx 46rpx 0 20rpx;
	}

	.detail>.btn>button {
		width: 40%;
		display: inline-block;
	}

	.photo .images {
		width: 80px;
		height: 80px;
	}

	.van-cell {
		padding: 13px 16px;
	}

	.van-hairline--top-bottom::after,
	.van-hairline-unset--top-bottom::after {
		border-top: 0px;
	}

	.van-cell__value {
		color: #3e3a39;
	}

	.fault-phenomenon {
		.fault-phenomenon-title {
			margin-bottom: 10px;
			padding-right: 20px;
			overflow: hidden;

			view:nth-of-type(1) {
				float: left;
				padding-top: 5px;
			}

			view:nth-of-type(2) {
				float: right;
				color: white;
				background-color: blue;
				width: 60px;
				height: 25px;
				line-height: 25px;
				border-radius: 6px;
				text-align: center;
			}
		}

		.fault-phenomenon-item {
			width: 95%;
			// margin: 0 auto;
			padding: 10px;
			background: #ffffff;
			box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05),
				2px 2px 4px rgba(0, 0, 0, 0.05);
			border-radius: 6px;
			// padding: 0 16px 16px 16px;
			padding-bottom: 16px;
			font-size: 14px;
			margin-bottom: 16px;
			color: #3e3a39;

			// border: 1px solid grey;
			.phenomenon-top {
				width: 100%;
				height: 50px;
				background-color: lightgrey;

				view {
					color: red;
					font-size: 16px;
					float: right;
					margin-top: 15px;
					margin-right: 12px;
				}
			}
		}
	}

	.fault-major {
		.fault-major-title {
			margin-bottom: 10px;
			padding-right: 20px;
			overflow: hidden;

			view:nth-of-type(1) {
				float: left;
				padding-top: 5px;
			}

			view:nth-of-type(2) {
				float: right;
				color: white;
				background-color: blue;
				width: 60px;
				height: 25px;
				line-height: 25px;
				border-radius: 6px;
				text-align: center;
			}
		}

		.fault-major-item {
			width: 95%;
			// margin: 0 auto;
			padding: 10px;
			background: #ffffff;
			box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05),
				2px 2px 4px rgba(0, 0, 0, 0.05);
			border-radius: 6px;
			// padding: 0 16px 16px 16px;
			padding-bottom: 16px;
			font-size: 14px;
			margin-bottom: 16px;
			color: #3e3a39;

			// border: 1px solid grey;
			.major-top {
				width: 100%;
				height: 50px;
				background-color: lightgrey;
				overflow: hidden;

				view:nth-of-type(1) {
					float: left;
					font-size: 15px;
					margin-top: 15px;
					margin-left: 12px;
					color: black;
				}

				view:nth-of-type(2) {
					color: red;
					font-size: 16px;
					float: right;
					margin-top: 15px;
					margin-right: 12px;
				}
			}
		}
	}

	.fault-circulation-item {
		width: 95%;
		padding: 16px 10px;
		margin-top: 18px;
		margin-bottom: 16px;
		background: #ffffff;
		box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05), 2px 2px 4px rgba(0, 0, 0, 0.05);
		border-radius: 6px;
		font-size: 14px;
		color: #3e3a39;
	}
</style>